#include <memory>
#include <stdio.h>
#include <memory.h>
#include <string.h>

using namespace std;


class Stu
{
public:
    int n;
    char name[100] = {0};

    ~Stu()
    {
        printf("~Stu()\n");
    }

    Stu()
    {
        printf("Stu()\n");
    }
};

class PCMBuf
{
public:
    static const int m_plane = 2;
    char* buf[m_plane];

    int m_size; //buf数组中一个元素的大小

    PCMBuf(int size)
    {
        m_size = size;
        char* data1 = (char*)malloc(size);
        char* data2 = (char*)malloc(size);
        memset(data1, 0, size);
        memset(data2, 0, size);
        buf[0] = data1;
        buf[1] = data2;
    }

    char** GetBuf() { return buf; }

    ~PCMBuf()
    {
        for(int i = 0; i < m_plane; i++)
        {
            if(buf[i] != NULL) 
            {
                free(buf[i]);
                buf[i] = NULL;
            }
        }
    }
};




int main()
{
    // printf("hello world\n");

    // shared_ptr<PCMBuf> pcmBuf;
    // pcmBuf = make_shared<PCMBuf>(10);

    // char** p = pcmBuf->GetBuf();
    
    // strcpy(p[0], "hello ");
    // strcpy(p[1], "world");
    // printf("%s%s\n", p[0], p[1]);
    

    return 0;
}